//
//  BaseViewController.swift
//  RXSwiftTest
//
//  Created by ZhangBo on 2019/6/18.
//  Copyright © 2019 ZhangBo. All rights reserved.
//

import UIKit
import RxSwift
import RxCocoa
import RxDataSources

class BaseViewController: UIViewController {
    
    deinit {
        print(#file, #function)
    }
    
    public lazy var navigationBar: CustomNavigationView = {
        let navigationBar = CustomNavigationView.loadViewFromNib()
        return navigationBar
    }()

    public lazy var progressView: UIProgressView = {
        let progressView = UIProgressView.init(frame: CGRect(x: 100, y: 100, width: 200, height: 40))
        progressView.progressViewStyle = .default
        progressView.progressTintColor = .blue
        let transform = CGAffineTransform(scaleX: 1.0, y: 8.0)
        progressView.transform = transform
        return progressView
    }()


    override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = .white
    }

    func addNavBar() {
        self.navigationItem.titleView = navigationBar
        navigationBar.titleLab.text = self.title
    }

    //显示消息
    func showAlert(title: String, message: String) {
        let alertController = UIAlertController(title: title,
            message: message, preferredStyle: .alert)
        let cancelAction = UIAlertAction(title: "确定", style: .cancel, handler: nil)
        alertController.addAction(cancelAction)
        self.present(alertController, animated: true, completion: nil)
    }

}
